package com.example.jixeishi1.cnofig;


import com.example.jixeishi1.entity.JsonResult;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

@ControllerAdvice
public class SysExceptionHandler {
    @ExceptionHandler(Exception.class)
public ModelAndView normal(Exception ex){
        ModelAndView mv=new ModelAndView();
        mv.setViewName("error/500");
        mv.addObject("errmsg",ex.getMessage());
    return mv;
}
@ExceptionHandler(com.example.jixeishi1.cnofig.AjaxException.class)
@ResponseBody
public JsonResult ajax(Exception ex){
    JsonResult js=new JsonResult(false,"查询成功",null);
    return js;
}
}
